package com.pi.base.util;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.serializer.SerializerFeature;

public class JsonTool {
	
	public static final String FORMATTER = "yyyy-MM-dd HH:mm";
	
	

	public static String toJsonString(Object data){
		return toJsonString(data,FORMATTER);
	}

	public static String toJsonString(Object data,String format){
		return JSON.toJSONStringWithDateFormat(data,format,SerializerFeature.WriteDateUseDateFormat,SerializerFeature.WriteMapNullValue,SerializerFeature.WriteNullNumberAsZero,SerializerFeature.WriteNullStringAsEmpty);
	}
	
}
